package com.ljx.recruitment.interview.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-12-03  10:16
 */
@Getter
@AllArgsConstructor
public enum RecommendEnum {

    YES(true, 1),
    NO(false, 2);

    private Boolean key;
    private Integer value;

    private static Map<Boolean, RecommendEnum> cache;

    static {
        cache = Arrays.stream(RecommendEnum.values()).collect(Collectors.toMap(RecommendEnum::getKey, Function.identity()));
    }

    public static RecommendEnum getByKey(Boolean key){
        return cache.get(key);
    }
}
